package com.meritit.config.jvm;

import java.util.HashMap;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.SynchronousQueue;

public class Demo extends ClassLoader {

	public static void main(String[] args) throws InterruptedException {
		BlockingQueue<String> queue = new SynchronousQueue<>();
		
		PriorityBlockingQueue<String> q = new PriorityBlockingQueue<>();
		
		
		new DThread(queue).start();
		
		queue.put("123");	
		queue.put("456");
		queue.put("789");
		queue.put("abc");
	}
	
	
	static class DThread extends Thread{
		
		private BlockingQueue<String> queue;
		
		public DThread(BlockingQueue<String> queue) {
			this.queue = queue;
		}
		
		@Override
		public void run() {
			while(true) {
				try {
					System.out.println("DThread Thread running..." + queue.take());
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		}
	}
}
